<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<link href="../css/main/base.css" rel="stylesheet" type="text/css"/>
<link href="../css/main/main.css" rel="stylesheet" type="text/css"/>

<body class="m_6" style="over">
<div id="main">
	<div class="zdsz" id="select1">
		<div class="tab"><h3 onclick="f1();">管理角色</h3><h3 onclick="f2();">新建角色</h3><h3 onclick="f3();">调整角色序号高低</h3><h3 class="sel" onclick="f4();">添加／删除权限</h3></div>
		<form action="role_modifyPermission.action" method="post">
		<div class="zd_gut">
		<ul class="block">
		<li>
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="tab_1 center">
				  <tr>
					<td align="center" colspan="2"><input onclick="managerPermission();" type="button" value="确定" class="log_f zc_b"/></td>
				  </tr>
				  <tr>
					<td align="left" colspan="2">修改角色:${baseRole.roleName}</td>
				    <input type="hidden" name="baseRole.roleId" value="${baseRole.roleId}"/>
				  </tr>
				</table></li>
				<div align="center"><font color="red">${info}</font> </div>
				<li>
                    <s:iterator value="sysMenus" status="menu" id="m1">
                    
                    <table width="160" border="0" cellspacing="0" cellpadding="0" class="tab_m left fl_l m_l">
                        <tr>
                          <td class="zc_lt1 font14"><input name="menu" id="${menuId}"  type="checkbox" value="${menuCode}" onclick="check_all(this,'${menuId}');"/>
                              <img src="${ctx}/images/menu/${menuImage}.gif"/>${menuName}</td>
                        </tr>
                       <s:iterator value="#m1.sysFuncs" status="func" id="f1">
                        <tr>
                          <td><div class="p_12">
                              <input name="func" id="${menuId}-<s:property value='#f1.funcId'/>" type="checkbox" value="<s:property value='#f1.funcId'/>" onclick="check_all(this,'${menuId}-<s:property value='#f1.funcId'/>');" <s:if test="#f1.funcId in func">checked</s:if> />
                              <s:property value='#f1.funcName'/></div></td>
                        </tr>
                        <s:iterator value="#f1.sysFuncs" status="function" id="f2">
                        <tr>
                          <td><div class="p_24">
                              <input name="func" id="${menuId}-<s:property value='#f1.funcId'/>-<s:property value='#f2.funcId'/>" type="checkbox" value="<s:property value='#f2.funcId'/>" onclick="check_all(this,'${menuId}-<s:property value='#f1.funcId'/>-<s:property value='#f2.funcId'/>');" <s:if test="#f2.funcId in func">checked</s:if>/>
                              <s:property value='#f2.funcName'/></div></td>
                        </tr>
                        </s:iterator>
                        </s:iterator>
                      </table>
                    </s:iterator>
		</li>
		</ul>
		<div class="bihe"></div>
		</div>
		</form>
	</div>
</div>
</body>
</html>
<script type="text/javascript">
<!--
	
	function f1(){
		window.location = "${ctx}/role/role!index.action";
	}
	function f2(){
		window.location = "${ctx}/role/role!preCreate.action";
	}
	function f3(){
		window.location = "${ctx}/role/role!preModifyOrder.action";
	}
	function f4(){
		window.location = "${ctx}/role/role!preManagePermission.action";
	}
	
		function check_all(id,index){
	var menu = document.getElementById(index);
	var temp = document.getElementsByName("func");
		for(var i=0;i<temp.length;i++){
			if(id.checked){
				var checkName = temp[i].id;
				if(checkName.indexOf(index) != -1){
					temp[i].checked = true;
				}
			}else{
				var checkName1 = temp[i].id;
				if(checkName1.indexOf(index) != -1){
					temp[i].checked = false;
				}
			}
		}
	}
	
	
	function managerPermission(){
	
		document.forms[0].submit();
	}
//-->
</script>
